package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.Objects;

@Entity
public class Outbound {
    private int outboundId;
    private Long outboundAllquantity;
    private Timestamp outboundTime;
    private String outboundWay;
    private String outboundPeople9;
    private Collection<OutboundDetails> outboundDetailsByOutboundId;

    @Id
    @Column(name = "outbound_id", nullable = false)
    public int getOutboundId() {
        return outboundId;
    }

    public void setOutboundId(int outboundId) {
        this.outboundId = outboundId;
    }

    @Basic
    @Column(name = "outbound_allquantity", nullable = true, precision = 0)
    public Long getOutboundAllquantity() {
        return outboundAllquantity;
    }

    public void setOutboundAllquantity(Long outboundAllquantity) {
        this.outboundAllquantity = outboundAllquantity;
    }

    @Basic
    @Column(name = "outbound_time", nullable = true)
    public Timestamp getOutboundTime() {
        return outboundTime;
    }

    public void setOutboundTime(Timestamp outboundTime) {
        this.outboundTime = outboundTime;
    }

    @Basic
    @Column(name = "outbound_way", nullable = true, length = 30)
    public String getOutboundWay() {
        return outboundWay;
    }

    public void setOutboundWay(String outboundWay) {
        this.outboundWay = outboundWay;
    }

    @Basic
    @Column(name = "outbound_people9", nullable = true, length = 50)
    public String getOutboundPeople9() {
        return outboundPeople9;
    }

    public void setOutboundPeople9(String outboundPeople9) {
        this.outboundPeople9 = outboundPeople9;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Outbound outbound = (Outbound) o;
        return outboundId == outbound.outboundId &&
                Objects.equals(outboundAllquantity, outbound.outboundAllquantity) &&
                Objects.equals(outboundTime, outbound.outboundTime) &&
                Objects.equals(outboundWay, outbound.outboundWay) &&
                Objects.equals(outboundPeople9, outbound.outboundPeople9);
    }

    @Override
    public int hashCode() {
        return Objects.hash(outboundId, outboundAllquantity, outboundTime, outboundWay, outboundPeople9);
    }

    @OneToMany(mappedBy = "outboundByOutboundId")
    public Collection<OutboundDetails> getOutboundDetailsByOutboundId() {
        return outboundDetailsByOutboundId;
    }

    public void setOutboundDetailsByOutboundId(Collection<OutboundDetails> outboundDetailsByOutboundId) {
        this.outboundDetailsByOutboundId = outboundDetailsByOutboundId;
    }
}
